<template>
  <div>
    <el-col :span="24" class="bg1">
      <div class="grid-content bg-purple">
        <FormPanel ref="formPanel" :list="formList" :cols="3" :labelWidth="110" :isSubmitBtn="false" @formChange="changeHandle" />
      </div>
    </el-col>
    <el-col :span="24" class="bg2">
      <BreakSpace label="VIN列表" :containerStyle="{ marginBottom: '10px' }"></BreakSpace>
      <FilterTable
        :isExportExcel="false"
        exportFileName="vin数据.xlsx"
        :onCalcExportData="handleExportFun"
        ref="table"
        height="200"
        :onSyncTableData="vinTableChangeFun"
        selectionType="single"
        :isSelectColumn="false"
        :columns="columns"
        datakey="records"
        :fetchapi="fetchapiVin"
        :params="fetchParamsVin"
        columnsRef="yxqPjxmTable"
        :onColumnsChange="columns => (this.columns = columns)"
        :onRowSelectChange="arr => (this.onChangeColumn = arr)"
      >
      </FilterTable>
    </el-col>

    <el-col :span="24" class="bg2">
      <BreakSpace label="活动项目列表" :containerStyle="{ marginBottom: '10px' }"></BreakSpace>

      <FilterTable
        ref="tableSport"
        selectionType="single"
        height="200"
        :isSelectColumn="false"
        :columns="columnSport"
        :onSyncTableData="sportTableChangeFun"
        :isMemoryPagination="true"
        columnsRef="yxqPjxmTable"
        :onColumnsChange="columns => (this.columnSport = columns)"
        :onRowSelectChange="arr => (this.onChangeColumn = arr)"
      >
      </FilterTable>
    </el-col>

    <el-col :span="24" class="bg2">
      <BreakSpace label="配件列表" :containerStyle="{ marginBottom: '10px' }"></BreakSpace>

      <FilterTable
        ref="tablePeij"
        height="200"
        :onSyncTableData="peijTableChangeFun"
        :onCellChange="onCellChange"
        :isSelectColumn="false"
        selectionType="single"
        :columns="columnPeij"
        :isMemoryPagination="true"
        columnsRef="yxqPjxmTable"
        :onColumnsChange="columns => (this.columnPeij = columns)"
        :onRowSelectChange="arr => (this.onChangeColumn = arr)"
      >
      </FilterTable>
    </el-col>

    <el-col :span="24" class="bg2">
      <BreakSpace label="索赔审核信息" :containerStyle="{ marginBottom: '10px' }"></BreakSpace>

      <FilterTable
        ref="tableSuopei"
        height="200"
        :isSelectColumn="false"
        selectionType="single"
        :isMemoryPagination="true"
        :columns="columnSuopei"
        columnsRef="yxqPjxmTable"
        :onColumnsChange="columns => (this.columnSuopei = columns)"
        :onRowSelectChange="arr => (this.onChangeColumn = arr)"
      >
      </FilterTable>
    </el-col>

    <el-col :span="24" class="bg1">
      <div class="grid-content bg-purple">
        <FormPanel ref="formPanel2" :list="formList2" :cols="3" :labelWidth="110" :isSubmitBtn="false" />
      </div>
    </el-col>
    <div class="dialogBottmView">
      <multiuse-button type="primary" class="btnStyle" :click="closeMenu.bind(this, 1)">审核通过</multiuse-button>

      <multiuse-button type="primary" class="btnStyle" :click="closeMenu.bind(this, 2)">驳回</multiuse-button>

      <multiuse-button type="primary" class="btnStyle" :click="closeMenu.bind(this, 3)">关闭</multiuse-button>
    </div>
  </div>
</template>

<script>
import { addTtRpMa, getByMaId, delMaItem, getVinByMaId, downVinTem, savePassOrBack, getAllUser, queryUnitCode } from '@/api/repair/batchEventManagement/activityDistribution';
import { dealerMixin } from '@/pages/repair/batchEventManagement/dealerMixin';

import { saveClaimPassOrBack } from '@/api/repair/batchEventManagement/activityClaim';

import { dictionary } from '@/utils/dictMixin';
import { isEmpty } from '@/utils/utils';
import { exportExcelFile } from '@/utils/index';
import { arrayObjDeWeight } from '@/utils';
import { getAppId } from '@/assets/js/auth';

export default {
  name: 'detail',
  mixins: [dictionary, dealerMixin],
  props: ['handleType', 'maId'],
  data() {
    this.saveData = null;
    return {
      columnSport: this.createTableColumnSport(),
      columnPeij: this.createTableColumnPeij(),
      columnSuopei: this.createTableColumnSuopei(),
      columns: this.createTableColumns(),
      formList: this.createFormList(),
      formList2: this.createFormList2(),
      visibleVin: false,
      visibleSport: false,
      visiblePeij: false,
      visibleMainCode: false,
      fetchParams: { xhrAbort: true },
      fetchParamPeij: { xhrAbort: true },
      fetchParamSport: { xhrAbort: true },
      fetchParamSuopei: { xhrAbort: true },
      fetchApiPeij: '',
      fetchapiVin: getVinByMaId,
      fetchParamsVin: { xhrAbort: true },
      fetchApi: '',
      fetchApiSport: '',
      fetchApiSuopei: '',
      onChangeColumn: [],
      vinArr: [] /**/,
      sportArr: [],
      peijArr: [],
      status: 1 /*1  表单选择  2 新建配件*/,
      detailObj: {},
      UploadFileIsShow: false,
      actionUrl: '/api/dmscloud.activity/ttRpMa/uploadVinTem'
    };
  },
  components: {},
  mounted() {
    this.BaseTable = this.$refs.table.$refs.pageTable;
    this.BaseSportTable = this.$refs.tableSport.$refs.pageTable;
    this.BasePeijTable = this.$refs.tablePeij.$refs.pageTable;
    this.BaseSuopeiTable = this.$refs.tableSuopei.$refs.pageTable;

    this.getData();

    this.initSelect();

    this.getUnit();
  },
  methods: {
    async getUnit() {
      // const res = await queryUnitCode();
      // this.columnPeij.find(item => item.dataIndex === 'unit').dictItems = res.data.map(x => ({
      //   text: x.UNIT_NAME,
      //   value: x.UNIT_CODE
      // }));

      this.getAllUnitCode(this.columnPeij, ['unit'], 'table');
    },

    handleExportFun(row) {
      row.vinStatus = this.createDictText(row.vinStatus, 1014);
    },

    async initSelect() {
      this.getAllUsers(this.columnSuopei, ['createdBy'], 'table');
      this.getAllDelears(this.columns, ['resDealer', 'salesDealer'], 'table');
    },

    /*配置数量发生改变的时候执行*/
    onCellChange(e, obj) {
      let counts = isEmpty(obj['counts']) ? '0' : obj['counts'];
      let price = isEmpty(obj['price']) ? '0' : obj['price'];
      let amount = obj['amount'];

      let toatalCount = isEmpty(parseInt(counts) * parseInt(price)) ? '0' : parseInt(counts) * parseInt(price);

      obj['amount'] = toatalCount;

      this.BasePeijTable.DO_REFRESH(false);

      // this.columnPeij.find((item,index)=>item.dataIndex=='amount').initialValue=1//toatalCount
    },

    /*导入*/
    importHandle() {
      this.handleType = 'import';
      this.UploadFileIsShow = true;
    },

    successHandler(e) {
      console.log('e:::', e);
      if (e != 1) {
        let obj = e[e.length - 1];
        let data = obj['url'];
        let error = data['error'];
        let successArr = data['success'];

        let newArr = [];
        console.log('successArr--', successArr);
        successArr.forEach((item, index) => {
          if (this.vinArr.length > 0) {
            this.vinArr.forEach((obj, pos) => {
              if (item['vin'] != obj['vin']) {
                newArr.push(item);
              }
            });
          } else {
            newArr.push(item);
          }
        });

        if (!isEmpty(error)) {
          this.$notify.error({ title: '提示信息', message: '导入失败数据为:' + error });
        }

        this.BaseTable.EXECUTE_INSERT(newArr);
      }
      this.UploadFileIsShow = false;
    },

    /*根据ID查询*/
    async getData() {
      let res = await getByMaId({ maId: this.maId });
      this.fetchParamsVin = Object.assign({}, this.fetchParamsVin, { maId: this.maId, xhrAbort: false });
      if (res.resultCode == 200 && res.success == true) {
        let data = isEmpty(res['data']) ? {} : res['data'];

        let ttRpMaAreas = data['ttRpMaAreas'];
        let ttRpMaLabours = data['ttRpMaLabours'];
        let ttRpMaParts = data['ttRpMaParts'];
        let ttRpMaLogVOS = data['ttRpMaLogVOS'];

        this.BaseTable.EXECUTE_INSERT(ttRpMaAreas);
        this.BaseSportTable.EXECUTE_INSERT(ttRpMaLabours);
        this.BasePeijTable.EXECUTE_INSERT(ttRpMaParts);
        this.BaseSuopeiTable.EXECUTE_INSERT(ttRpMaLogVOS);

        for (let i in data) {
          this.formList.map(x => {
            if (i == x.fieldName) {
              console.log(data[i]);
              x.initialValue = data[i];
            }
          });
        }
      }
    },

    peijTableChangeFun(val) {
      this.peijArr = val;
    },

    vinTableChangeFun(val) {
      this.vinArr = val;
      console.log('val---', val);
    },

    sportTableChangeFun(val) {
      this.sportArr = val;
      console.log('val---', val);
    },

    /**/
    async savePassOrBackStatus(checkStatus) {
      let [err, data] = await this.$refs.formPanel.GET_FORM_DATA();
      if (err) {
        // this.$notify.warning({ title: '提示信息', message: '请检查必填项！！！' });
        return;
      }

      let remarks = this.formList2.find(item => item.fieldName == 'checkRemarks').initialValue;
      let ifSettle = this.formList.find(item => item.fieldName == 'ifSettle').initialValue;

      if (isEmpty(remarks)) {
        this.$notify.warning({ title: '提示信息', message: '审核说明不能为空' });
        return;
      }

      if (isEmpty(ifSettle)) {
        ifSettle = '';
      }
      let res = await saveClaimPassOrBack({
        checkRemarks: remarks,
        checkStatus: checkStatus,
        maId: this.maId,
        ifSettle: ifSettle
      });

      if (res.resultCode == 200 && res.success == true) {
        this.$notify.success({ title: '提示信息', message: '操作成功' });
        this.$emit('close', 'refresh');
      } else {
        // let errMsg = isEmpty(res.errMsg) ? '操作失败' : res.errMsg;
        //
        // this.$notify.error({title: '提示信息', message: errMsg});
      }
    },

    async closeMenu(type) {
      if (type == '1') {
        await this.savePassOrBackStatus('10041001');
      } else if (type == '2') {
        await this.savePassOrBackStatus('10041002');
      } else {
        this.$emit('close');
      }
    },
    closeDialog() {
      console.log('关闭');
      this.visibleVin = false;
      this.visibleSport = false;
      this.visiblePeij = false;
    },

    /*flag   part:配件删除  area：vin删除  labour ： 项目删除*/
    async delByEdit(flag, id, row) {
      let res = await delMaItem({ flag: flag, id: id });
      if (res.resultCode == 200 && res.success == true) {
        this.$notify.success({ title: '提示信息', message: '操作成功' });

        if (flag == 'area') {
          this.BaseTable.EXECUTE_DELETE([row]);
        } else if (flag == 'labour') {
          this.BaseSportTable.EXECUTE_DELETE([row]);
        } else {
          this.BasePeijTable.EXECUTE_DELETE([row]);
        }
      } else {
        let errMsg = isEmpty(res.errMsg) ? '操作失败' : res.errMsg;

        this.$notify.error({ title: '提示信息', message: errMsg });
      }
    },

    /*vin删除*/
    vinDelFun(row) {
      if (this.handleType == 'edit') {
        this.delByEdit('area', row['areaId'], row);
      } else {
        this.BaseTable.EXECUTE_DELETE([row]);
      }
    },

    /*配件删除*/
    peijDelFun(row) {
      if (this.handleType == 'edit') {
        this.delByEdit('part', row['mpId'], row);
      } else {
        this.BasePeijTable.EXECUTE_DELETE([row]);
      }
    },

    /*配件 */
    selectPeijFun(arr) {
      this.closeDialog();

      if (this.status == 1) {
        /*表单选择*/
        console.log('表单');
        this.formList.find(item => item.fieldName == 'partCode').initialValue = arr[0].partCode;
        this.formList.find(item => item.fieldName == 'partName').initialValue = arr[0].partName;
      } else {
        console.log('新建配件');
        let newArr = [];
        arr.forEach((item, index) => {
          var pos = this.peijArr.findIndex((value, index, arr) => {
            return value['partId'] == item['partId'];
          });
          if (pos == -1) {
            newArr.push(item);
          }
        });
        this.BasePeijTable.EXECUTE_INSERT(newArr);
      }
    },

    /*VIN  添加*/
    selectFun(arr) {
      this.closeDialog();

      let newArr = [];
      arr.forEach((item, index) => {
        var pos = this.vinArr.findIndex((value, index, arr) => {
          return value['vin'] == item['vin'];
        });
        if (pos == -1) {
          newArr.push(item);
        }
      });

      this.BaseTable.EXECUTE_INSERT(newArr);
    },

    /*活动删除*/
    sportDelFun(row) {
      if (this.handleType == 'edit') {
        this.delByEdit('labour', row['mlId'], row);
      } else {
        this.BaseSportTable.EXECUTE_DELETE([row]);
      }
    },

    /*添加 活动*/
    selectSportFun(arr) {
      this.closeDialog();

      let newArr = [];
      arr.forEach((item, index) => {
        var pos = this.sportArr.findIndex((value, index, arr) => {
          return value['labourId'] == item['labourId'];
        });
        if (pos == -1) {
          newArr.push(item);
        }
      });
      this.BaseSportTable.EXECUTE_INSERT(newArr);
    },

    changeHandle(val) {
      this.saveData = val;
    },

    seacherFun() {
      this.status = 1;
      this.visiblePeij = true;
    },
    /*添加配件*/
    addPeij() {
      this.status = 2;
      this.visiblePeij = true;
    },

    /*添加活动*/
    addSport() {
      this.visibleSport = true;
    },

    /*添加vpn*/
    addVpn() {
      this.visibleVin = true;
    },

    createFormList() {
      return [
        {
          type: 'BREAK_SPACE',
          label: '批量活动基本信息'
        },

        {
          type: 'INPUT',
          label: '活动编号',
          fieldName: 'maNo',
          itemList: [],
          disabled: true,
          placeholder: '',
          // rules: [{required: true, trigger: 'change'}],
          initialValue: ''
        },
        {
          type: 'INPUT',
          label: '活动主题',
          fieldName: 'maTitle',
          disabled: true,
          rules: [{ required: false, trigger: 'change' }],
          placeholder: '请输入',
          initialValue: ''
        },
        {
          type: 'SELECT',
          label: '是否OTA活动',
          fieldName: 'ifOta',
          placeholder: '',
          initialValue: '',
          hidden: getAppId().toLowerCase() == 'arcfox' ? true : false,
          disabled: true,
          rules: [{ required: false, trigger: 'change' }],
          itemList: this.createDictList(1004)
        },
        {
          type: 'INPUT',
          label: '批量活动完成率',
          fieldName: 'overRate',
          placeholder: '',
          disabled: true,
          rules: [{ required: false, trigger: 'change' }],
          initialValue: ''
        },
        {
          type: 'DATE',
          label: '活动开始日期',
          fieldName: 'bDate',
          disabled: true,
          format: 'yyyy-MM-dd',
          placeholder: '请选择',
          rules: [{ required: false, trigger: 'change' }],
          initialValue: ''
        },

        {
          type: 'DATE',
          label: '活动截止日期',
          fieldName: 'eDate',
          disabled: true,
          format: 'yyyy-MM-dd',
          placeholder: '请选择',
          rules: [{ required: false, trigger: 'change' }],
          initialValue: ''
        },
        {
          type: 'INPUT',
          label: '主损件代码',
          fieldName: 'partCode',
          placeholder: '请选择',
          disabled: true,
          initialValue: ''
        },
        {
          type: 'INPUT',
          label: '主损件名称',
          fieldName: 'partName',
          placeholder: '请选择',
          disabled: true,
          initialValue: ''
        },
        {
          type: 'INPUT',
          label: '供应商代码',
          fieldName: 'supCode',
          placeholder: '请选择',
          disabled: true,
          initialValue: ''
        },
        {
          type: 'INPUT',
          label: '供应商',
          fieldName: 'supName',
          placeholder: '请选择',
          readonly: true,
          disabled: true
        },
        {
          type: 'INPUT',
          label: '故障现象代码',
          fieldName: 'faultCode',
          readonly: true,
          disabled: true
        },
        {
          type: 'INPUT',
          label: '故障现象描述',
          fieldName: 'faultName',
          placeholder: '请输入...',
          initialValue: undefined,
          disabled: true
        },
        {
          type: 'INPUT',
          label: '一级代码',
          fieldName: 'sysCode1',
          placeholder: '请输入...',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '一级名称',
          fieldName: 'sysName1',
          placeholder: '请输入...',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '二级代码',
          fieldName: 'sysCode2',
          placeholder: '请输入...',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '二级名称',
          fieldName: 'sysName2',
          placeholder: '请输入...',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '三级代码',
          fieldName: 'sysCode3',
          placeholder: '请输入...',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '三级名称',
          fieldName: 'sysName3',
          placeholder: '请输入...',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '故障代码',
          fieldName: 'sysCode4',
          placeholder: '请输入...',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '故障描述',
          fieldName: 'sysName4',
          placeholder: '请输入...',
          disabled: true
        },
        {
          type: 'SELECT',
          label: '是否返件',
          fieldName: 'isReturn',
          placeholder: '请选择',
          disabled: true,
          // rules: [{ required: true, message: '请选择', trigger: 'change' }],
          itemList: this.createDictList(1004),
          initialValue: '',
          disabled: true
        },
        {
          type: 'INPUT',
          label: '分类',
          fieldName: 'frCode',
          readonly: true,
          disabled: true
        },
        {
          type: 'INPUT',
          label: '故障原因描述',
          fieldName: 'frName',
          placeholder: '请输入故障原因描述...',
          initialValue: undefined,
          disabled: true
        },
        {
          type: 'SELECT',
          label: '是否索赔结算',
          fieldName: 'ifSettle',
          placeholder: '请选择',
          disabled: true,
          // rules: [{ required: true, message: '请选择', trigger: 'change' }],
          itemList: this.createDictList(1004),
          initialValue: ''
        },
        {
          type: 'INPUT',
          label: '预算编号',
          fieldName: 'budgetNo',
          placeholder: '请选择',
          disabled: true,
          initialValue: ''
        },
        {
          type: 'SELECT',
          label: '活动等级',
          fieldName: 'maLevel',
          placeholder: '',
          initialValue: '',
          disabled: true,
          rules: [{ required: false, trigger: 'change' }],
          itemList: this.createDictList(1017)
        },

        {
          type: 'INPUT',
          label: '活动策略',
          fieldName: 'maStrategy',
          placeholder: '请选择',
          disabled: true,
          rules: [{ required: false, trigger: 'change' }],
          initialValue: ''
        },

        {
          type: 'TEXT_AREA',
          label: '活动说明',
          fieldName: 'maRemarks',
          placeholder: '请选择',
          disabled: true,
          rules: [{ required: false, trigger: 'change' }],
          initialValue: '',
          selfCols: 3
        },
        {
          type: 'SELECT',
          label: '配件满足情况',
          fieldName: 'ifPart',
          placeholder: '',
          disabled: true,
          hidden: false,
          initialValue: '',
          rules: [{ required: false, trigger: 'change' }],
          itemList: this.createDictList(1004)
        },
        {
          type: 'INPUT',
          label: '配件满足百分比',
          fieldName: 'percent',
          placeholder: '',
          disabled: true,
          hidden: false,
          initialValue: '',
          rules: [{ required: false, trigger: 'change' }]
        },
        {
          type: 'SELECT',
          label: '技术文件情况',
          disabled: true,
          fieldName: 'ifTech',
          placeholder: '',
          hidden: false,
          initialValue: '',
          rules: [{ required: false, trigger: 'change' }],
          itemList: this.createDictList(1004)
        },
        {
          type: 'SELECT',
          label: '活动状态',
          disabled: true,
          fieldName: 'maStatus',
          placeholder: '',
          hidden: false,
          initialValue: '',
          rules: [{ required: false, trigger: 'change' }],
          itemList: this.createDictList(1014)
        },
        {
          type: 'INPUT_NUMBER',
          label: '经销商修改销售状态时效(天)',
          labelWidth: '180px',
          disabled: true,
          fieldName: 'editDate',
          placeholder: '',
          hidden: false,
          initialValue: '',
          rules: [{ required: false, trigger: 'change' }]
        },
        {
          type: 'DATE',
          label: '考核截止日期',
          fieldName: 'verifyDate',
          placeholder: '请选择',
          disabled: true,
          format: 'yyyy-MM-dd',
          hidden: false,
          initialValue: '',
          rules: [{ required: false, trigger: 'change' }]
        },
        {
          type: 'SELECT',
          label: '是否返件',
          fieldName: 'isReturn',
          placeholder: '请选择',
          disabled: true,
          // rules: [{ required: true, message: '请选择', trigger: 'change' }],
          itemList: this.createDictList(1004),
          initialValue: ''
        }
      ];
    },
    createFormList2() {
      return [
        {
          type: 'BREAK_SPACE',
          label: '审核说明'
        },
        {
          type: 'TEXT_AREA',
          label: '审核说明',
          fieldName: 'checkRemarks',
          placeholder: '请选择',
          disabled: false,
          rules: [{ required: true, trigger: 'change', message: '审核说明不能为空' }],
          initialValue: '',
          selfCols: 3,
          maxlength: 300
        }
      ];
    },
    /*索赔*/
    createTableColumnSuopei() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 70,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '操作人',
          dataIndex: 'createdBy',
          showOverflowTooltip: true,
          sorter: true,
          filter: true,
          filterType: 'checkbox',
          filterItems: [],
          dictItems: []
        },
        {
          title: '操作时间',
          dataIndex: 'createdAt',
          sorter: true,
          filter: true,
          filterType: 'date-range'
        },
        {
          title: '操作后状态',
          dataIndex: 'checkStatus',
          sorter: true,
          filter: true,
          filterType: 'checkbox',
          filterItems: this.createDictList(1022),
          render: props => {
            console.log(props.row.checkStatus);
            return <span>{this.createDictText(props.row.checkStatus, 1022)}</span>;
          }
        },
        {
          title: '审核说明',
          dataIndex: 'checkRemarks',
          sorter: true,
          filter: true,
          filterType: 'input'
        }
      ];
    },

    /*配件*/
    createTableColumnPeij() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 70,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '配件代码',
          dataIndex: 'partCode',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '配件名称',
          dataIndex: 'partName',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '单位',
          dataIndex: 'unit',
          sorter: true,
          filter: true,
          filterType: 'checkbox',
          filterItems: [],
          dictItems: []
        },
        {
          title: '数量',
          dataIndex: 'counts',
          sorter: true,
          filter: true,
          filterType: 'input',
          editType: 'number',
          editable: false
        },
        {
          title: '索赔单价',
          dataIndex: 'price',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '索赔总价',
          dataIndex: 'amount',
          sorter: true,
          filter: true,
          filterType: 'input'
        }
      ];
    },

    /*活动*/
    createTableColumnSport() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 70,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '活动项目代码',
          dataIndex: 'labourCode',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '活动项目名称',
          dataIndex: 'labourName',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '项目类型',
          dataIndex: 'labourType',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '标准工时',
          dataIndex: 'stdLabourHour',
          sorter: true,
          filter: true,
          filterType: 'input'
        }
      ];
    },
    createTableColumns() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 70,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: 'VIN',
          dataIndex: 'vin',
          width: 150,
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '车辆状态',
          dataIndex: 'vinStatus',
          sorter: true,
          filter: true,
          filterType: 'checkbox',
          filterItems: this.createDictList(6040),
          dictItems: this.createDictList(6040)
        },
        {
          title: '责任经销商',
          dataIndex: 'resDealer',
          sorter: true,
          filter: true,
          filterItems: [],
          filterType: 'checkbox',
          dictItems: []
        },
        {
          title: '车型名称',
          dataIndex: 'modelName',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '客户名称',
          dataIndex: 'name',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '客户电话',
          dataIndex: 'mobile',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '生产日期',
          dataIndex: 'productionDate',
          sorter: true,
          dateFormat: 'yyyy-MM-dd',
          filter: true,
          filterType: 'date-range'
        },
        {
          title: '销售日期',
          dataIndex: 'salesDate',
          sorter: true,
          dateFormat: 'yyyy-MM-dd',
          filter: true,
          filterType: 'date-range'
        },
        {
          title: '销售经销商',
          dataIndex: 'salesDealer',
          sorter: true,
          filter: true,
          filterItems: [],
          filterType: 'checkbox',
          dictItems: []
        }
      ];
    }
  }
};
</script>

<style scoped lang="less">
.bg1 {
  border: 1px solid @borderColor;
  border-radius: @borderRadius;
  box-shadow: @boxShadow;
  padding: @modulePadding;
  padding-left: 0;
  padding-top: 15px;
  padding-bottom: 15px;
}

.bg2 {
  margin-top: 10px;
  margin-bottom: 10px;
}

.btn {
  text-align: center;
}

.btnStyle {
  margin-top: 10px;
}
</style>
